
// 按脚本路径查找定时任务
let tasks = $timers.queryTimedTasks({
    path: "/sdcard/脚本/钉钉打卡.js"
});
if(tasks.length!=0){
    tasks.forEach(t => {
        $timers.removeTimedTask(t.id)
    });
}
sleep(2000)
console.log("tasks len :" + tasks.length);
console.log("开始创建定时任务");

// 上班
addWeeklyTask("08:50")
// 下班
addWeeklyTask("06:30")

exit()
function addWeeklyTask(timeStr){
    var task = $timers.addWeeklyTask({
        path: "/sdcard/脚本/钉钉打卡.js",
        time: timeStr,
        daysOfWeek: ['一', '二', '三', '四', '五'],
        delay: 0,
        loopTimes: 1,
        interval: 0
    });
    return task;
}



// console.log("end= "+tasks);